package cn.wolfcode.trip.base.mapper;

import cn.wolfcode.trip.base.domain.Travel;
import cn.wolfcode.trip.base.query.TravelQuery;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface TravelMapper {
    int deleteByPrimaryKey(Long id);

    int insert(Travel record);

    Travel selectByPrimaryKey(Long id);

    List<Travel> selectAll();

    int updateByPrimaryKey(Travel record);

    List<Travel> selectForList(TravelQuery qo);

    void updateState(Travel ravel);

    /**
     * admin 查询攻略游记
     * @param qo
     * @return
     */
    List<Travel> selectStrategyTravel(TravelQuery qo);

    /**
     * admin 查询游记的收藏数
     * @param travelId
     * @return
     */
    Integer selectCollectCountForTravel(Long travelId);

    /**
     * app 更新攻略游记的收藏数
     * @param strategyId
     * @param travelId
     * @param count
     */
    void updateCollectCountForStrategyTravel(@Param("strategyId") Long strategyId, @Param("travelId") Long travelId, @Param("count") Integer count);

    /**
     * app 获取攻略游记
     * @param strategyId
     * @return
     */
    List<Travel> selectStrategyTravelsByStrategyId(Long strategyId);

    /**
     * admin 根据id获取攻略游记
     * @param strategyId
     * @param travelId
     * @return
     */
    Travel selectById(@Param("strategyId") Long strategyId, @Param("travelId") Long travelId);

    List<Long> selectByUserId(Long userId);
}